package com.sourcespro.mybatis.dao;

import com.sourcespro.mybatis.annotation.LRTreeDelete;
import com.sourcespro.mybatis.crudparams.PageInfo;
import com.sourcespro.mybatis.entity.Tree;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 分类 Mapper
 *
 * @author 张浩伟
 * @date 2018/07/09
 */
@Mapper
public interface TreeMapper {

    int insert(Tree record);

    int updateById(Tree record);

    Tree findById(Long id);

    Tree findByUuid(String uuid);

    List<Tree> findByPid(Long pid);

    List<Tree> findByLftAndRgt(@Param("lft") Integer lft, @Param("rgt") Integer rgt);

    List<Tree> findPage();

    int count();

    @LRTreeDelete
    int deleteById(Long id);

    @LRTreeDelete
    int deleteByUuid(String uuid);

    int deleteChildrenCascade(@Param("lft") Integer lft, @Param("rgt") Integer rgt);
}